Views
No views yet

<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
TheBloke/Writing_Partner_Mistral_7B-AWQ.Writing_Partner_Mistral_7B-AWQ--quantization awq parameter.python3 -m vllm.entrypoints.api_server --model TheBloke/Writing_Partner_Mistral_7B-AWQ --quantization awq --dtype autoquantization=awq.1from vllm import LLM, SamplingParams
2
3prompts = [
4 "Tell me about AI",
5 "Write a story about llamas",
6 "What is 291 - 150?",
7 "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
8]
9prompt_template=f'''<|im_start|>system
10{system_message}<|im_end|>
11<|im_start|>user
12{prompt}<|im_end|>
13<|im_start|>assistant
14'''
15
16prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
17
18sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
19
20llm = LLM(model="TheBloke/Writing_Partner_Mistral_7B-AWQ", quantization="awq", dtype="auto")
21
22outputs = llm.generate(prompts, sampling_params)
23
24# Print the outputs.
25for output in outputs:
26 prompt = output.prompt
27 generated_text = output.outputs[0].text
28 print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")ghcr.io/huggingface/text-generation-inference:1.1.0--model-id TheBloke/Writing_Partner_Mistral_7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096pip3 install huggingface-hub1from huggingface_hub import InferenceClient
2
3endpoint_url = "https://your-endpoint-url-here"
4
5prompt = "Tell me about AI"
6prompt_template=f'''<|im_start|>system
7{system_message}<|im_end|>
8<|im_start|>user
9{prompt}<|im_end|>
10<|im_start|>assistant
11'''
12
13client = InferenceClient(endpoint_url)
14response = client.text_generation(prompt,
15 max_new_tokens=128,
16 do_sample=True,
17 temperature=0.7,
18 top_p=0.95,
19 top_k=40,
20 repetition_penalty=1.1)
21
22print(f"Model output: ", response)pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl1pip3 uninstall -y autoawq
2git clone https://github.com/casper-hansen/AutoAWQ
3cd AutoAWQ
4pip3 install .1from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
2
3model_name_or_path = "TheBloke/Writing_Partner_Mistral_7B-AWQ"
4
5tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
6model = AutoModelForCausalLM.from_pretrained(
7 model_name_or_path,
8 low_cpu_mem_usage=True,
9 device_map="cuda:0"
10)
11
12# Using the text streamer to stream output one token at a time
13streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
14
15prompt = "Tell me about AI"
16prompt_template=f'''<|im_start|>system
17{system_message}<|im_end|>
18<|im_start|>user
19{prompt}<|im_end|>
20<|im_start|>assistant
21'''
22
23# Convert prompt to tokens
24tokens = tokenizer(
25 prompt_template,
26 return_tensors='pt'
27).input_ids.cuda()
28
29generation_params = {
30 "do_sample": True,
31 "temperature": 0.7,
32 "top_p": 0.95,
33 "top_k": 40,
34 "max_new_tokens": 512,
35 "repetition_penalty": 1.1
36}
37
38# Generate streamed output, visible one token at a time
39generation_output = model.generate(
40 tokens,
41 streamer=streamer,
42 **generation_params
43)
44
45# Generation without a streamer, which will include the prompt in the output
46generation_output = model.generate(
47 tokens,
48 **generation_params
49)
50
51# Get the tokens from the output, decode them, print them
52token_output = generation_output[0]
53text_output = tokenizer.decode(token_output)
54print("model.generate output: ", text_output)
55
56# Inference is also possible via Transformers' pipeline
57from transformers import pipeline
58
59pipe = pipeline(
60 "text-generation",
61 model=model,
62 tokenizer=tokenizer,
63 **generation_params
64)
65
66pipe_output = pipe(prompt_template)[0]['generated_text']
67print("pipeline output: ", pipe_output)
68Loader: AutoAWQ.
<|im_start|>system
<|im_end|>
<|im_start|>user
How to plot my story?<|im_end|>
<|im_start|>assistantI like this opening! It sets up some interesting questions and intrigue right off the bat. But I do think you might want to reconsider your point of view in the first paragraph. Right now it sounds more like a summary than an actual scene because there isn't any dialogue or action. Consider starting with something more immediate, perhaps from Alara's perspective. You could even begin with her looking out at the stars, thinking about what she sees. This will give us a chance to get to know her better before you launch into the big picture stuff. Here's an example:Alara Voss leaned against the cold metal railing of the observation deck, staring out into the infinite expanse of blackness that surrounded her ship. Stars dotted the night sky like scattered diamonds, each one a potential destination, each one a mystery waiting to be solved. She took a deep breath and let it out slowly, savoring the feeling of freedom that washed over her. It had been months since they'd left Earth, and already their journey had taken them light-years away from everything they knew. Her thoughts were interrupted by the low hum of the quantum drive kicking in, signaling that they were ready to make another jump. She watched as the stars began to blur together, forming a shimmering pathway that led the way to their next adventure."Captain," came the voice of her second-in-command over the intercom. "We're entering the Veil of Eternity.""Thank you, Ensign," Alara replied, not taking her eyes off the swirling vortex ahead. "Let's see what lies beyond."
Dialogue is a very important part of writing fiction. It's the way characters speak, and it helps define who they are. It also moves the story forward and adds tension, humor, or emotion. Dialogue must be realistic and natural-sounding, but it doesn't have to be boring. You want your readers to pay attention to what the characters are saying, so make sure that each line of dialogue counts.Here are some tips on how to write good dialogue:
Keep it short. Long speeches get tedious quickly. If one character talks for more than two sentences, break up his speech with an action or interjection from another character. Use contractions (I'm, he'll). They sound more like real conversation than formal language does. Vary sentence structure. This makes dialogue easier to read and understand. Don't use slang unless it fits the setting or character perfectly. Slang dates easily and may not mean anything to future generations. Avoid using too many adverbs in dialogue tags. Instead of "he said loudly," try something like "he bellowed." Or "she whispered." Be careful not to give away too much information in dialogue tags. For example, if you say "Sarah laughed nervously," you're telling the reader she was nervous rather than showing her anxiety through her words or actions. Make sure your characters don't all talk alike. Each person should have a unique voice, based on his background, education, age, gender, etc. Don't forget about body language. The way someone holds himself, sits, stands, fidgets, or looks at others can add depth to a scene. Use dialogue to reveal character traits and motivations. Listen carefully to people around you, and then translate those conversations onto paper. Finally, remember that dialogue needs to serve a purpose in your story. Whether it advances the plot, sets the mood, or creates conflict, every word spoken by your characters should move the narrative along.