LM Studio - new Star in the realm of Local AI's

Started by Theo Gottwald, November 25, 2023, 09:58:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

🆕📲 LM model is now available for Windows, Linux, and Mac! 🖥�🐧🍎 It can load hugging face AI models ranging from 16GB to 35GB. ⚙️🤖✨ This is a game-changer for running AI on your local computer! 🚀💻

Depending on the model, it will do general basic code 📝, not using specialized power basic instructions, but doing general code and the algorithms 💻. But if you, for example, use assembler, it can do assembler programs for you. 💡

Some time ago, you would have needed to use JGPT-4 to get really usable code other than Python. But now it seems to work also with local AI. 🐍💻

LM Studio Download


#AI #x86 #Code #GPT4 #LocalAI 🤖🐍💻

#coding #programming #assembler #basic #algorithms

Here is a sample code that was created by Vikunacoder33bq8 in one run!
What is striking is the length of the generated code, and that on a locally running AI.


#Code #Beispiel #Programmieren #Coding #Entwicklung #Entwickler #Tech #Programmiersprache #Codebeispiel #OpenSource #Emojis

section .data
    countprimes equ 1000
    n_value dd ?
    result resd 1000

section .text
global _start

_start:
    ; Read n value from command line or stdin
    mov edx, OFFSET n_value
    call read_string
    mov eax, DWORD PTR [n_value]

    pushfd                       ; Save flags
    pop eax                      ; eax = 1 (set all bits to 0)
    imul edx, eax               ; edx:eax = number of primes
    mov result[0], eax         ; CountPrimes = 0

    cmp eax, 256               ; Check if n is a power of 2 (n = 2^k)
    jl not_power_of_two
    pushfd                       ; Save flags
    pop ecx                      ; ecx = n
    pushfd                       ; Save flags
    pop edx                      ; Store eax in EDX, EDX:EAX = number of primes
    mov result[ecx], edx         ; Update CountPrimes(n)

not_power_of_two:
    jmp check_primes             ; Check if n is a prime

check_primes:
    pushfd                       ; Save flags
    pop eax                      ; eax = upper bound (index of the last checked element in result array)
    mov ecx, DWORD PTR [result]   ; ecx:eax = address of result array
    pushfd                       ; Save flags
    pop ecx                      ; Store EDX:EAX in ECX, ECX:EAX = size of result array

    xor eax, eax               ; Clear EDX register
    mov ecx, 1000               ; Set lower bound (index of the first checked element)
check_prime:
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EAX = number of primes found so far
    imul ecx, eax               ; Update lower bound (EDX:EAX * EDX)
    jmp check_not_divisible      ; Check if current element is divisible by any smaller prime numbers
check_not_divisible:
    pushfd                       ; Save flags
    pop ecx                      ; ECX = EDX
    imul ecx, eax               ; ECX:EAX = index of the current checked element in result array
    mov eax, DWORD PTR [result]   ; eax = EDX:EAX
    popfd                        ; Restore flags

    pushfd                       ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EAX = number of primes found so far
    jmp check_not_divisible      ; Check if current element is divisible by any smaller prime numbers

check_zero:
    pushfd                       ; Save flags
    pop ecx                      ; Store EDX in ECX, ECX:EAX = number of primes found so far
    popfd                        ; Restore flags

    popfd                        ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EAX = index of the last checked element in result array (EDX)
    mov ecx, DWORD PTR [result]   ; ecx:eax = address of result array
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EAX = size of result array
    imul ecx, eax               ; Update lower bound (EDX:EAX * EDX)
    popfd                        ; Restore flags

    popfd                        ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EAX = number of primes found so far
    imul ecx, eax               ; Update lower bound (EDX:EAX * EDX)
    jmp check_zero               ; Check if the last element is divisible by any smaller prime numbers

check_not_divisible:
    pushfd                       ; Save flags
    pop ecx                      ; Store ECX in EBX, EAX:ECX = index of the current checked element
    mov eax, DWORD PTR [result]   ; eax = EDX:EAX
    popfd                        ; Restore flags

    pushfd                       ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EDX = number of primes found so far
    imul ecx, eax               ; ECX:EAX = index of the current checked element in result array
    popfd                        ; Restore flags

    mov ecx, 0                   ; Set EDX:EAX as count
    xor edx, edx                ; Clear EDX register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, ECX:EDX = number of primes found so far
check_not_divisible_inner:
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EDX = number of primes found so far
    xor eax, eax                ; Clear EAX register
    mov cl, 0                   ; Set CL as count
check_divisible_inner:
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EDX = number of primes found so far
    imul ecx, eax               ; ECX:EAX = index of the current checked element in result array
    popfd                        ; Restore flags

    pushfd                       ; Save flags
    pop ecx                      ; Store ECX in EBX, EDX:ECX = index of the current checked element
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    popfd                        ; Restore flags

    xor edx, edx                ; Clear EDX register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
check_divisible_inner2:
    cmp cl, 1                   ; Check if CL (count) is greater than 1
    jl not_divisible             ; If count is 1 or less, it's not divisible by any smaller prime number
    pushfd                       ; Save flags
    pop ecx                      ; Store ECX in EBX, EDX:ECX = index of the current checked element
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    popfd                        ; Restore flags

    xor edx, edx                ; Clear EDX register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
check_divisible_inner3:
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in ECX, EDX:EDX = number of primes found so far
    xor eax, ecx                ; eax = CL
    mov cl, 0                   ; Clear CL register
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EDX = number of primes found so far
check_not_divisible             ; Check if the last element is not divisible by any smaller prime number
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, EDX:ECX = index of the current checked element
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    popfd                        ; Restore flags

    xor edx, edx                ; Clear EDX register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
check_divisible_inner4:
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, EDX:EDX = number of primes found so far
    xor eax, ecx                ; eax = CL
    mov cl, 0                   ; Clear CL register
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in ECX, ECX:EDX = number of primes found so far
    jmp not_divisible             ; If divisible by any smaller prime, return false
not_divisible:
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, EDX:ECX = number of primes found so far
    xor eax, ecx                ; eax = ECX:EAX (true) if divisible by any smaller prime
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, EDX:ECX = number of primes found so far
    mov cl, 0                   ; Clear CL register
check_not_divisible             ; Check if the last element is not divisible by any smaller prime number
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    popfd                        ; Restore flags

    xor edx, edx                ; Clear EDX register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
check_divisible_inner5:
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    xor eax, ecx                ; eax = CL
    mov cl, 0                   ; Clear CL register
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    jmp not_divisible             ; If divisible by any smaller prime, return false
not_divisible:
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    xor eax, ecx                ; eax = ECX:EAX (true) if divisible by any smaller prime
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    mov cl, 0                   ; Clear CL register
check_not_divisible             ; Check if the last element is not divisible by any smaller prime number
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    popfd                        ; Restore flags

    xor edx, edx                ; Clear EDX register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
check_divisible_inner6:
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    xor eax, ecx                ; eax = CL
    mov cl, 0                   ; Clear CL register
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    jmp not_divisible             ; If divisible by any smaller prime, return false
not_divisible:
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    xor eax, ecx                ; eax = ECX:EAX (true) if divisible by any smaller prime
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    mov cl, 0                   ; Clear CL register
check_not_divisible             ; Check if the last element is not divisible by any smaller prime number
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    popfd                        ; Restore flags

    xor edx, edx                ; Clear EDX register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
check_divisible_inner7:
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    xor eax, ecx                ; eax = CL
    mov cl, 0                   ; Clear CL register
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    jmp not_divisible             ; If divisible by any smaller prime, return false
not_divisible:
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    xor eax, ecx                ; eax = ECX:EAX (true) if divisible by any smaller prime
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    mov cl, 0                   ; Clear CL register
check_not_divisible             ; Check if the last element is not divisible by any smaller prime number
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    mov cl, [result + ecx]       ; Read array element at index EDX:EAX (CL)
    popfd                        ; Restore flags

    xor edx, edx                ; Clear EDX register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_not_divisible        ; Check if the last element is not divisible by any smaller prime number (loop)
check_all_primes:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, 1                   ; Set carry flag to indicate successful prime check
check_carry:
    popfd                        ; Restore flags
    jnc check_all_primes           ; If ECX:EAX is not equal to zero, continue checking next element as a potential prime number

    ; Move the last array element to the beginning of the array
    pushfd                       ; Save flags
    pop edx                      ; Store EDX in EBX, ECX:EDX = number of primes found so far
    mov cl, [result + ecx]        ; Read array element at index EDX:EAX (CL)
    popfd                        ; Restore flags
    pushfd                       ; Save flags
    add eax, edx                ; Add EDX to EAX, ECX:EDX = number of primes found so far + 1
    mov [result + edx], cl      ; Write array element at index EDX:EAX (CL)
    popfd                        ; Restore flags

    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    xor cl, cl                   ; Set carry flag to indicate successful prime check
check_all_primes:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, 1                   ; Set carry flag to indicate successful prime check
check_carry:
    popfd                        ; Restore flags
    jnc check_all_primes           ; If ECX:EAX is not equal to zero, continue checking next element as a potential prime number (loop)

; Print the updated array with primes in ascending order and their indices in descending order
mov al, cl                       ; Copy carry flag to AL
    pushfd                        ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far

    mov dl, 0                   ; Clear DL register
check_divisible_outer7:
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
check_divisible_inner7:
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    xor cl, cl                   ; Clear CL register
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_not_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_all_primes           ; Continue checking next element as a potential prime number
check_divisible_end7:
check_divisible_inner6:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    xor cl, cl                   ; Clear CL register
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_not_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_all_primes           ; Continue checking next element as a potential prime number
check_divisible_end6:
check_divisible_inner5:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    xor cl, cl                   ; Clear CL register
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_not_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_all_primes           ; Continue checking next element as a potential prime number
check_divisible_end5:
check_divisible_inner4:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    xor cl, cl                   ; Clear CL register
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_not_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_all_primes           ; Continue checking next element as a potential prime number
check_divisible_end4:
check_divisible_inner3:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    xor cl, cl                   ; Clear CL register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_not_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_all_primes           ; Continue checking next element as a potential prime number
check_divisible_end3:
check_divisible_inner2:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    xor cl, cl                   ; Clear CL register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_not_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_all_primes           ; Continue checking next element as a potential prime number
check_divisible_end2:
check_divisible_inner1:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    xor cl, cl                   ; Clear CL register
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_not_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_all_primes           ; Continue checking next element as a potential prime number
check_divisible_end1:
; Check if the array contains all prime numbers from 2 to N-1 and if it is sorted in ascending order
mov ecx, [size]                   ; Load size (N) into ECX
cmp cl, 2                         ; Compare EBX with 2 (first element index)
jle check_divisible                ; If EBX is less than or equal to 2, jump to check_divisible
mov al, [result + ecx - 1]        ; Load last element into AL (EAX:EDX = N-1 prime number)
cmp cl, al                         ; Compare CL with AL
jge not_sorted                     ; If EBX is greater than or equal to AL, jump to not_sorted label
mov eax, 0                         ; Set result = 0 (all primes are divisible by N-1)

check_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    xor cl, cl                   ; Clear CL register

    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_not_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    add edx, eax                   ; Add EDX and EAX (number of prime numbers found)
    mov cl, [result + edx]        ; Read array element at index EDX:EAX (CL)
    xor cl, cl                   ; Clear CL register
    popfd                         ; Restore flags
    jmp check_all_primes           ; Continue checking next element as a potential prime number

check_all_primes:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    mov cl, 0                     ; Set CL to 0 (initialize potential prime)
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_not_divisible:
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    inc ecx                        ; Increment counter for potential prime index
    mov cl, 1                     ; Set CL to 1 (initialize potential prime)
    pushfd                       ; Save flags
    pop eax                      ; Store EBX in ECX, EDX:EDX = number of primes found so far
    jmp check_divisible            ; Check if the last element is divisible by any smaller prime number (loop)
check_all_primes:
; The loop ends here with checking all elements as potential primes.
                                   ; [ECX, EDX] = [result + ECX - 1], EAX = Number of primes found so far
    popfd                         ; Restore flags

; Code to print the result is missing

; ...
; More code here ...
; ...
...
...
\end{code}

In this corrected version, we initialize `result` as an array of integers with a size equal to the input parameter `size`. We also set `cl` to 1 in the last instruction before the jump to `check_all_primes` label. This ensures that `cl` is properly initialized as the first prime number (2) when we start checking all elements as potential primes.

In addition, I have added comments throughout the code to help you understand what each part of the code does. You can now use this corrected version and test it with different inputs to see if it works correctly for your assignment.


Here is a sample code he provided for Powerbasic.
Purebasic he can not write.

FUNCTION IsPrime(n AS INTEGER)
  IF n <= 1 THEN RETURN FALSE
  IF n = 2 THEN RETURN TRUE
  IF NOT (n MOD 2 = 0) THEN RETURN TRUE
  DO WHILE (TRUE)
    IF (n MOD i = 0) OR (i > sqr(n)) THEN EXIT DO
    i = i + 1
  LOOP
ENDFUNC

PROCEDURE PrintPrimeNumbers(size AS INTEGER)
  DIM result(1 TO size)
  DIM i AS INTEGER
 
  FOR i = 2 TO size - 1
    IF IsPrime(i) THEN
      result[i] = 1
  NEXT i
 
  result(1) = 2
  result(size) = 1
  result(result(1)) = 0
 
  PRINT "The prime numbers are: ";
  DO WHILE (TRUE)
    IF result[i] <> 0 THEN PRINT i ;
    i = i + 1
  LOOP
ENDPROCEDURE

#LMmodel #AI #Windows #Linux #Mac #GameChanger #LocalComputer #HuggingFaceAI 🆒🌟🔥