Views
No views yet
meta-llama/Meta-Llama-3-8B-Instruct on the vanessasml/cybersecurity_32k_instruction_input_output dataset.vanessasml/cybersecurity_32k_instruction_input_output, a dataset focused on cybersecurity news analysis.
No special data format was applied as recommended, although the following steps need to be applied to adjust the input:1# During training
2from trl import setup_chat_format
3
4model, tokenizer = setup_chat_format(model, tokenizer)
5
6# During inference
7messages = [
8 {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
9 {"role": "user", "content": "Who are you?"},
10]
11
12prompt = pipeline.tokenizer.apply_chat_template(
13 messages,
14 tokenize=False,
15 add_generation_prompt=True
16)meta-llama/Meta-Llama-3-8B-Instruct.nf4. Nested quantization is disabled.float16 to ensure efficient computation.64160.11import transformers
2
3model_name = "vanessasml/cyber-risk-llama-3-8b-instruct-sft"
4
5# Example of how to use the model:
6pipeline = transformers.pipeline(
7 "text-generation",
8 model=model_name,
9 model_kwargs={"torch_dtype": torch.bfloat16},
10 device="cuda",
11)
12
13messages = [
14 {"role": "system", "content": SYSTEM_PROMPT},
15 {"role": "user", "content": "What are the main 5 cyber classes from the NIST cyber framework?"},
16]
17
18prompt = pipeline.tokenizer.apply_chat_template(
19 messages,
20 tokenize=False,
21 add_generation_prompt=True
22)
23
24terminators = [
25 pipeline.tokenizer.eos_token_id,
26 pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
27]
28
29outputs = pipeline(
30 prompt,
31 max_new_tokens=256,
32 eos_token_id=terminators,
33 do_sample=True,
34 temperature=0.6,
35 top_p=0.9,
36)
37print(outputs[0]["generated_text"][len(prompt):])1@misc{cyber-risk-llama-3-8b-instruct-sft,
2 author = {Vanessa Lopes},
3 title = {Cyber-risk-llama-3-8B-Instruct-sft Model},
4 year = {2024},
5 publisher = {HuggingFace Hub},
6 journal = {HuggingFace Model Hub}
7}