QWEN CHAT GitHub Hugging Face ModelScope Kaggle DEMO DISCORD
Introduction Today, we are excited to announce the release of Qwen3, the latest addition to the Qwen family of large language models. Our flagship model, Qwen3-235B-A22B, achieves competitive results in benchmark evaluations of coding, math, general capabilities, etc., when compared to other top-tier models such as DeepSeek-R1, o1, o3-mini, Grok-3, and Gemini-2.5-Pro. Additionally, the small MoE model, Qwen3-30B-A3B, outcompetes QwQ-32B with 10 times of activated parameters, and even a tiny model like Qwen3-4B can rival the performance of Qwen2.
Okay, let’s tackle this problem step by step. The user wants a script that sorts all .gguf files into subdirectories based on their publisher, which is derived from the URLs in the dl*.txt files. Hmm, first, I need to figure out how to extract the publisher from each URL.
The example URL given is https://huggingface.co/unsloth/Qwen3-30B-A3B-GGUF/resolve/main/Qwen3-30B-A3B-Q6_K.gguf?download=true, and the publisher here is ‘unsloth’. Looking at the URL structure, the publisher is the first path component after the domain. So, after ‘huggingface.co’, the next part is the publisher.
So, the plan is: for each .gguf file in the current directory, find its corresponding URL in any of the dl*.txt files. Then parse that URL to get the publisher, create a directory if it doesn’t exist, and move the file there. But wait, how do I link each .gguf file to its URL? The filenames might not directly correspond to the URLs, so maybe the filenames are part of the URL paths?
Alternatively, perhaps each line in the dl*.txt files contains a URL that ends with the filename. So, the filename is the last part of the URL before any query parameters. For example, in the example URL, the filename is Qwen3-30B-A3B-Q6_K.gguf. So, the script can look through all the dl*.txt files, parse each URL, extract the filename from the URL, and then check if that filename exists in the current directory. If it does, then we can get the publisher from that URL and move the file accordingly.
Wait, but the problem states that the URLs are in the dl files, and each .gguf file was downloaded from one of those URLs. So each .gguf file corresponds to exactly one URL in one of the dl files. Therefore, the script needs to:
Collect all the URLs from all dl*.txt files, ignoring comments (lines starting with #).
For each URL, extract the filename (the part after the last ‘/’ before any ‘?’) and the publisher (the first path component after the domain).
Create a dictionary mapping filenames to their respective publishers.
Iterate over all .gguf files in the current directory. For each file:
a. Check if its name is in the filename-publisher map.
b. If yes, create the publisher directory if it doesn’t exist.
c. Move the file into that directory.
d. If not found, maybe log a warning or skip?
But first, how to parse the URLs correctly. Let’s think about splitting the URL. The example URL’s path after the domain is ‘/unsloth/Qwen3-30B-A3B-GGUF/resolve/main/Qwen3-30B-A3B-Q6_K.gguf’. The first path component after the domain is ‘unsloth’, which is the publisher. So splitting the path by ‘/’ and taking the second element (since the first is empty due to leading ‘/’) would give the publisher.
For the filename, the last part of the path before any query parameters. So split the URL on ‘?’ to get the path part, then split on ‘/’ and take the last element.
Potential edge cases: URLs with different domains? The example uses huggingface.co, but maybe others could be present. But the problem says “the publisher can only be found in the URL used to originally download each .gguf file”, so the structure should be consistent. So the first path component after the domain is always the publisher.
Now, steps for the script:
First, process all dl*.txt files. For each file:
Read each line.
Ignore lines starting with #.
For each valid URL line:
Parse the URL to get the publisher and filename.
How to do this in bash? Maybe using parameter expansion or cut.
Alternatively, using awk or sed. Let’s think of code snippets.
Wait, actually, the URL is split into parts by the slashes. The third component (index 2 if starting from 0) is huggingface.co. The fourth component (index 3) is unsloth, which is the publisher.
So, to get the publisher, we can take the 4th field when splitting by ‘/’.
Wait, perhaps using:
publisher=$(echo $url | awk -F/ ‘{print $4}’)
Yes, because:
The URL is split into fields by ‘/’, so $4 would be ‘unsloth’.
Similarly, for the filename:
The filename is the last part before any ‘?’, take the first part, then split on ‘/’ and take the last element. Alternatively, using basename:
Then, we can build an associative array (in bash) mapping filenames to publishers.
Once all URLs are processed, we can loop over the .gguf files in the current directory. For each file:
Check if its name is in the filename-publisher map.
If yes, create the directory if needed, then move.
Else, perhaps skip or report an error.
Now, in bash, associative arrays can be used. Let’s structure the code:
First, read all the dl files.
declare -A publisher_map
for dlfile in dl*.txt; do
while IFS= read -r line; do
# Ignore comments and empty lines
if [[ $line == #* || -z $line ]]; then
continue
fi
url=“$line”
# Extract publisher
publisher=$(echo "$url" | awk -F/ '{print $4}')
# Extract filename
fname=$(basename "$(echo "$url" | cut -d '?' -f1)")
# Store in the map
publisher_map["$fname"]=$publisher
done < "$dlfile"
done
Then, process each .gguf file:
for file in *.gguf; do
if [[ ! -f $file ]]; then
continue
fi
fname=$(basename “$file”)
if [[ -v publisher_map[$fname] ]]; then
publisher=${publisher_map[$fname]}
dir="$publisher"
mkdir -p "$dir"
mv -- "$file" "$dir/"
echo "Moved $file to $dir"
else
echo "Warning: $file has no corresponding URL in dl files. Skipping."
fi
done
Wait, but in bash, checking if a key exists in an associative array uses -v, so that part is okay.
But need to make sure that the filenames are exactly as they appear in the URL’s path. For example, if the URL’s filename has a different case, or maybe trailing spaces? Probably need to ensure exact matches.
Another thing: what about files that are not in any of the dl files? The problem says “all .gguf files”, but perhaps some files were not downloaded via these URLs? The user might want those to be skipped, or maybe an error. But according to the problem statement, they need to be sorted into subdirectories based on their original download URLs, so files not present in any dl file ca
[…trimmed because lemmy won’t handle so many chars]
QwQ-32B-Q6_K - Answer
Here’s a bash script to organize the .gguf files into publisher directories based on their download URLs:
#!/bin/bash# Create an associative array to hold filename -> publisher mappingsdeclare -A publisher_map
# Process all dl*.txt filesfor dlfile in dl*.txt; dowhile IFS= read -r line; do# Skip comments and empty linesif [[ $line == \#* || -z $line ]]; thencontinuefi
url="$line"# Extract publisher (4th part after splitting on '/')
publisher=$(echo"$url" | awk -F/ '{print $4}')
# Extract filename (basename of path without query parameters)
fname=$(basename"$(echo "$url" | cut -d '?' -f1)")
# Store in the map
publisher_map["$fname"]=$publisherdone < "$dlfile"done# Process each .gguf filefor file in *.gguf; doif [[ ! -f $file ]]; thencontinuefi
fname=$(basename"$file")
if [[ -v publisher_map[$fname] ]]; then
publisher=${publisher_map[$fname]}dir="$publisher"# Create directory if not existsmkdir -p "$dir"# Move the filemv -- "$file""$dir/"echo"Moved '$file' to '$dir'"elseecho"Warning: No publisher found for '$file'" >&2
fidone
To use this script:
Save it as sort_gguf.sh in your current directory
Make it executable: chmod +x sort_gguf.sh
Run it: ./sort_gguf.sh
This script does the following:
Reads all URLs from any dl*.txt files
Ignores commented lines (starting with #)
Extracts the publisher from each URL (4th path component after the domain)
Extracts the filename from each URL (basename of path without query params)
Creates a mapping between filenames and their publishers
Creates directories for each publisher if they don’t exist
Moves each .gguf file to its corresponding publisher directory
Shows progress messages for moved files
Gives warnings for files with no matching URL entries
Note: The script assumes:
The URLs are properly formatted as shown in the example
Each .gguf file has a corresponding URL entry in one of the dl*.txt files
File names exactly match the ones in the URLs (case-sensitive)
QwQ-32B-Q6_K:
Amt:3313, Process:107.21s (1.74T/s), Generate:3463.16s (0.96T/s), Total:3570.37s
QwQ-32B-Q6_K - Thoughts (11010 characters)
<think>
Okay, let’s tackle this problem step by step. The user wants a script that sorts all .gguf files into subdirectories based on their publisher, which is derived from the URLs in the dl*.txt files. Hmm, first, I need to figure out how to extract the publisher from each URL.
The example URL given is
https://huggingface.co/unsloth/Qwen3-30B-A3B-GGUF/resolve/main/Qwen3-30B-A3B-Q6_K.gguf?download=true
, and the publisher here is ‘unsloth’. Looking at the URL structure, the publisher is the first path component after the domain. So, after ‘huggingface.co’, the next part is the publisher.So, the plan is: for each .gguf file in the current directory, find its corresponding URL in any of the dl*.txt files. Then parse that URL to get the publisher, create a directory if it doesn’t exist, and move the file there. But wait, how do I link each .gguf file to its URL? The filenames might not directly correspond to the URLs, so maybe the filenames are part of the URL paths?
Alternatively, perhaps each line in the dl*.txt files contains a URL that ends with the filename. So, the filename is the last part of the URL before any query parameters. For example, in the example URL, the filename is Qwen3-30B-A3B-Q6_K.gguf. So, the script can look through all the dl*.txt files, parse each URL, extract the filename from the URL, and then check if that filename exists in the current directory. If it does, then we can get the publisher from that URL and move the file accordingly.
Wait, but the problem states that the URLs are in the dl files, and each .gguf file was downloaded from one of those URLs. So each .gguf file corresponds to exactly one URL in one of the dl files. Therefore, the script needs to:
But first, how to parse the URLs correctly. Let’s think about splitting the URL. The example URL’s path after the domain is ‘/unsloth/Qwen3-30B-A3B-GGUF/resolve/main/Qwen3-30B-A3B-Q6_K.gguf’. The first path component after the domain is ‘unsloth’, which is the publisher. So splitting the path by ‘/’ and taking the second element (since the first is empty due to leading ‘/’) would give the publisher.
For the filename, the last part of the path before any query parameters. So split the URL on ‘?’ to get the path part, then split on ‘/’ and take the last element.
Potential edge cases: URLs with different domains? The example uses huggingface.co, but maybe others could be present. But the problem says “the publisher can only be found in the URL used to originally download each .gguf file”, so the structure should be consistent. So the first path component after the domain is always the publisher.
Now, steps for the script:
First, process all dl*.txt files. For each file:
How to do this in bash? Maybe using parameter expansion or cut.
Alternatively, using awk or sed. Let’s think of code snippets.
Parsing the publisher:
Given a URL like ‘https://huggingface.co/unsloth/…’, the path starts after ‘huggingface.co/’. So splitting the URL into parts after the domain.
Maybe using cut:
domain_part=$(echo $url | cut -d ‘/’ -f 3) # gets huggingface.co path_part=$(echo $url | cut -d ‘/’ -f 4-) # gets everything after the domain
Then the first element of path_part is the publisher. So split path_part on ‘/’ again.
publisher=$(echo $path_part | cut -d ‘/’ -f 1)
Wait, let’s see:
For the example URL:
Original URL: https://huggingface.co/unsloth/Qwen3-30B-A3B-GGUF/resolve/main/Qwen3-30B-A3B-Q6_K.gguf?download=true
Breaking down:
After splitting by ‘/’, the components are:
0: https: 1: 2: huggingface.co 3: unsloth 4: Qwen3-30B-A3B-GGUF 5: resolve 6: main 7: Qwen3-30B-A3B-Q6_K.gguf?download=true
Wait, actually, the URL is split into parts by the slashes. The third component (index 2 if starting from 0) is huggingface.co. The fourth component (index 3) is unsloth, which is the publisher.
So, to get the publisher, we can take the 4th field when splitting by ‘/’.
Wait, perhaps using:
publisher=$(echo $url | awk -F/ ‘{print $4}’)
Yes, because:
The URL is split into fields by ‘/’, so $4 would be ‘unsloth’.
Similarly, for the filename:
The filename is the last part before any ‘?’, take the first part, then split on ‘/’ and take the last element. Alternatively, using basename:
filename=$(basename $(echo $url | cut -d ‘?’ -f1))
Yes, that’s better. For example, the URL part before ? is:
https://huggingface.co/unsloth/Qwen3-30B-A3B-GGUF/resolve/main/Qwen3-30B-A3B-Q6_K.gguf
basename of that is “Qwen3-30B-A3B-Q6_K.gguf”.
So putting it all together, for each URL line:
publisher=$(echo “$url” | awk -F/ ‘{print $4}’) filename=$(basename “$(echo “$url” | cut -d ‘?’ -f1)”)
Then, we can build an associative array (in bash) mapping filenames to publishers.
Once all URLs are processed, we can loop over the .gguf files in the current directory. For each file:
Now, in bash, associative arrays can be used. Let’s structure the code:
First, read all the dl files.
declare -A publisher_map
for dlfile in dl*.txt; do while IFS= read -r line; do # Ignore comments and empty lines if [[ $line == #* || -z $line ]]; then continue fi url=“$line”
done
Then, process each .gguf file:
for file in *.gguf; do if [[ ! -f $file ]]; then continue fi fname=$(basename “$file”)
done
Wait, but in bash, checking if a key exists in an associative array uses -v, so that part is okay.
But need to make sure that the filenames are exactly as they appear in the URL’s path. For example, if the URL’s filename has a different case, or maybe trailing spaces? Probably need to ensure exact matches.
Another thing: what about files that are not in any of the dl files? The problem says “all .gguf files”, but perhaps some files were not downloaded via these URLs? The user might want those to be skipped, or maybe an error. But according to the problem statement, they need to be sorted into subdirectories based on their original download URLs, so files not present in any dl file ca […trimmed because lemmy won’t handle so many chars]
QwQ-32B-Q6_K - Answer
Here’s a bash script to organize the .gguf files into publisher directories based on their download URLs:
#!/bin/bash # Create an associative array to hold filename -> publisher mappings declare -A publisher_map # Process all dl*.txt files for dlfile in dl*.txt; do while IFS= read -r line; do # Skip comments and empty lines if [[ $line == \#* || -z $line ]]; then continue fi url="$line" # Extract publisher (4th part after splitting on '/') publisher=$(echo "$url" | awk -F/ '{print $4}') # Extract filename (basename of path without query parameters) fname=$(basename "$(echo "$url" | cut -d '?' -f1)") # Store in the map publisher_map["$fname"]=$publisher done < "$dlfile" done # Process each .gguf file for file in *.gguf; do if [[ ! -f $file ]]; then continue fi fname=$(basename "$file") if [[ -v publisher_map[$fname] ]]; then publisher=${publisher_map[$fname]} dir="$publisher" # Create directory if not exists mkdir -p "$dir" # Move the file mv -- "$file" "$dir/" echo "Moved '$file' to '$dir'" else echo "Warning: No publisher found for '$file'" >&2 fi done
To use this script:
sort_gguf.sh
in your current directorychmod +x sort_gguf.sh
./sort_gguf.sh
This script does the following:
Note: The script assumes: