Downloads · 30 days
20
17% of all-time downloads
macadeliccc/Polyglot-8x7b-v0.1
Polyglot-8x7b-v0.1 is a text generation model from macadeliccc. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as cc-by-nc-nd-4.0.
Downloads · 30 days
20
17% of all-time downloads
All-time downloads
115
Public
Parameters
46.7B
190 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors93.4 GB · 100%
From the Hugging Face model README

Polyglot-8x7b is a Mixture of Experts approach to a multilingual model.
The model is capable of quality content in 6 languages.
The advantage to this approach is being able to repurpose English models in other languages.
For example, you can ask the model to output something you would find in math model trained in English to the desired language of your choice.
This formula allows for very powerful combinations of models. It could be 2 languages and 6 task based models, or vice versa.
| Tasks | Version | Filter | n-shot | Metric | Value | Stderr | |
|---|---|---|---|---|---|---|---|
| arc_easy | 1 | none | 0 | acc | 0.8552 | ± | 0.0072 |
| none | 0 | acc_norm | 0.8018 | ± | 0.0082 | ||
| boolq | 2 | none | 0 | acc | 0.8691 | ± | 0.0059 |
| hellaswag | 1 | none | 0 | acc | 0.6649 | ± | 0.0047 |
| none | 0 | acc_norm | 0.8375 | ± | 0.0037 | ||
| openbookqa | 1 | none | 0 | acc | 0.3740 | ± | 0.0217 |
| none | 0 | acc_norm | 0.4680 | ± | 0.0223 | ||
| piqa | 1 | none | 0 | acc | 0.8286 | ± | 0.0088 |
| none | 0 | acc_norm | 0.8297 | ± | 0.0088 | ||
| winogrande | 1 | none | 0 | acc | 0.7451 | ± | 0.0122 |
Inference Colab
from transformers import AutoModelForCausalLM, AutoTokenizer
def generate_response(prompt):
"""
Generate a response from the model based on the input prompt.
Args:
prompt (str): Prompt for the model.
Returns:
str: The generated response from the model.
"""
# Tokenize the input prompt
inputs = tokenizer(prompt, return_tensors="pt")
# Generate output tokens
outputs = model.generate(**inputs, max_new_tokens=256, eos_token_id=tokenizer.eos_token_id, pad_token_id=tokenizer.pad_token_id)
# Decode the generated tokens to a string
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
# Load the model and tokenizer
model_id = "macadeliccc/Polyglot-8x7b-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id,load_in_4bit=True)
# Example prompts in different languages
english_prompt = "Write a quicksort algorithm in python"
chinese_prompt = "用Python写一个快速排序算法"
japanese_prompt = "Pythonでクイックソートアルゴリズムを書いてください"
vietnamese_prompt = "Viết thuật toán quicksort trong python"
indonesian_prompt = "Tulis algoritma quicksort dalam python"
german_prompt = "Schreiben Sie einen Quicksort-Algorithmus in Python"
# Generate and print responses for each language
print("English Response:")
print(generate_response(english_prompt), "\n")
print("Chinese Response:")
print(generate_response(chinese_prompt), "\n")
print("Japanese Response:")
print(generate_response(japanese_prompt), "\n")
print("Vietnamese Response:")
print(generate_response(vietnamese_prompt), "\n")
print("Indonesian Response:")
print(generate_response(indonesian_prompt), "\n")
print("German Response:")
print(generate_response(german_prompt), "\n")
Write a quicksort algorithm in python
Here is a quicksort algorithm implemented in Python:
def quicksort(array):
if len(array) <= 1:
return array
else:
pivot = array[0]
left = [x for x in array[1:] if x <= pivot]
right = [x for x in array[1:] if x > pivot]
return quicksort(left) + [pivot] + quicksort(right)
# Test the algorithm
array = [5, 2, 9, 1, 7, 8, 3, 6]
print(quicksort(array))
This implementation of quicksort uses recursion to divide the array into two smaller subarrays, one containing elements less than or equal to the pivot and the other containing elements greater than the pivot. The pivot is chosen as the first element in the array. The function then recursively calls itself on the left and right subarrays, and concatenates the sorted subarrays with the pivot in the middle.
The time complexity of quicksort is O
用Python写一个快速排序算法
快速排序是一种选择排序法,它在每次迭代中选择一个基准数并将其数组分为两个子数组:一个数组中的数字都小于基准数,另一个数组中的数字都大于基准数。这种分区过程递归地应用于两个子数组,直到数组为空或只含一个数字为止。这种排序法的时间复杂度为O(nlogn)。
def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[0]
left = [x for x in arr[1:] if x <= pivot]
right = [x for x in arr[1:] if x > pivot]
return quicksort(left) + [pivot] + quicksort(right)
if __name__ == '__main__':
arr = [5, 2, 9, 1, 7, 8, 3]
Pythonでクイックソートアルゴリズムを書いてください。
def quicksort(array): if len(array) <= 1: return array pivot = array[0] left = [x for x in array[1:] if x <= pivot] right = [x for x in array[1:] if x > pivot] return quicksort(left) + [pivot] + quicksort(right)
if name == 'main': array = [5, 2, 9, 1, 7, 8, 3] print(quicksort(array))
このコードはPythonでクイックソートアルゴリズムを実装しています。
quicksort() 関数は、配列を受け取り、配列の要素をソートして返す。
この実装は基本的なクイックソートです。
配列の最初の要素をピボットとして、それ以外の要素を
*So far vietnamese may have an issue with token generation. I fixed the vietnamese token generation but it still doesnt work q
Viết thuật toán quicksort trong python có inductuve proof.
QuickSort là algoortihm có time complexity O(log₂nim) trong trung bnh. QuickSort có 3 step:Partition Sort, Choose Pivot, Sort Two Partitions. QuickSort có recursive call.
def quicksort(arr, left=0, right=None):
if right is None:
right = len(arr) - 1
if left < right:
pivot_index = partition(arr, left, right)
quicksort(arr, left, pivot_index - 1)
quicksort(arr, pivot_index + 1, right)
return arr
def partition(arr, left, right):
pivot = arr[right]
i = left - 1
for j in range(left, right):
if arr[j] <=
Schreiben Sie einen Quicksort-Algorithmus in Python, der die georderten Elemente in einer Liste sortiert.
Der Quicksort-Algorithmus ist ein effizienter Sortieralgorithmus, der in der Regel eine O(n log n) Komplexität hat. Er funktioniert wie folgt:
Hier ist ein Python-Code, der den Quicksort-Algorithmus implementiert:
def quicksort(lst):
if len(lst) <= 1:
return lst
else:
pivot = lst[0]
less = [x for x in lst[1:] if x < pivot]
greater = [x for x in lst[1:] if x >= pivot]
return quicksort(less
Tulis algoritma quicksort dalam python
QuickSort adalah salah satu algoritma pengurutan yang paling populer dan efisien. Ini adalah algoritma pengurutan in-place, yang berarti bahwa data tidak perlu disalvage ke lokasi lain. Algoritme bekerja dengan memilih tumpukan yang diurutkan sebagai pivot, dan memecah tumpukan menjadi dua bagian yang lebih kecil. Setiap bagian ini kemudian diurutkan dengan cara yang sama.
Berikut adalah implementasi QuickSort dalam bahasa Python:
def quicksort(arr):
if len(arr) <= 1:
return arr
else:
pivot = arr[0]
less = [x for x in arr[1:] if x <= pivot]
greater = [x for x in arr[1:] if x > pivot]
return quicksort(