--- tags: - deepsparse --- ```python from deepsparse import TextGeneration model = TextGeneration(model="hf:mgoin/Nous-Hermes-llama-2-7b-ds") prompt="""### Instruction: Write a Perl script that processes a log file and counts the occurrences of different HTTP status codes. The script should accept the log file path as a command-line argument and print the results to the console in descending order of frequency. ### Response: """ print(model(prompt, max_new_tokens=500).generations[0].text) ``` Output: ``` #!/usr/bin/perl use strict; use warnings; my $log_file = $ARGV[0]; open(my $fh, '<', $log_file) or die "Could not open file '$log_file' $!"; my %status_count; while (my $line = <$fh>) { chomp $line; my @status_codes = split(/\s+/, $line); for my $status_code (@status_codes) { $status_count{$status_code}++; } } close($fh); foreach my $status_code (sort { $status_count{$b} <=> $status_count{$a} } keys %status_count) { print "$status_code: $status_count{$status_code}\n"; } ```