fromoptimum.rblnimportRBLNLlamaForCausalLMfromtransformersimportAutoTokenizer# Load and compile the model with inline parametersmodel=RBLNLlamaForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf",export=True,# Set to True for compilationrbln_batch_size=1,rbln_max_seq_len=512,# Optional, inferred from model config if not specifiedrbln_num_devices=1,# Rebel100™ compiles for one NPU)# Load tokenizer and prepare inputstokenizer=AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")inputs=tokenizer("Hello, I'm a language model",return_tensors="pt")# Generate text with the modeloutputs=model.generate(**inputs,max_new_tokens=64)
fromoptimum.rblnimportRBLNLlamaForCausalLMfromtransformersimportAutoTokenizer# Load and compile the model with inline parametersmodel=RBLNLlamaForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf",export=True,# Set to True for compilationrbln_batch_size=1,rbln_max_seq_len=512,# Optional, inferred from model config if not specifiedrbln_num_devices=4,# For multi-device execution)# Load tokenizer and prepare inputstokenizer=AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")inputs=tokenizer("Hello, I'm a language model",return_tensors="pt")# Generate text with the modeloutputs=model.generate(**inputs,max_new_tokens=64)
fromoptimum.rblnimportRBLNLlamaForCausalLM,RBLNLlamaForCausalLMConfigfromtransformersimportAutoTokenizer# Define configuration through RBLNConfig objectconfig=RBLNLlamaForCausalLMConfig(batch_size=1,max_seq_len=4096,num_devices=1)# Load and compile the model with config objectmodel=RBLNLlamaForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf",export=True,rbln_config=config)# Load tokenizer and prepare inputstokenizer=AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")inputs=tokenizer("Hello, I'm a language model",return_tensors="pt")# Generate text with the modeloutputs=model.generate(**inputs,max_new_tokens=64)
fromoptimum.rblnimportRBLNLlamaForCausalLM,RBLNLlamaForCausalLMConfigfromtransformersimportAutoTokenizer# Define configuration through RBLNConfig objectconfig=RBLNLlamaForCausalLMConfig(batch_size=1,max_seq_len=4096,num_devices=4)# Load and compile the model with config objectmodel=RBLNLlamaForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf",export=True,rbln_config=config)# Load tokenizer and prepare inputstokenizer=AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")inputs=tokenizer("Hello, I'm a language model",return_tensors="pt")# Generate text with the modeloutputs=model.generate(**inputs,max_new_tokens=64)
fromoptimum.rblnimportRBLNAutoModelForCausalLMfromtransformersimportAutoTokenizer# Load and compile the model with inline parametersmodel=RBLNAutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf",export=True,# Set to True for compilationrbln_batch_size=1,rbln_max_seq_len=512,# Optional, inferred from model config if not specifiedrbln_num_devices=1,# Rebel100™ compiles for one NPU)# Load tokenizer and prepare inputstokenizer=AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")inputs=tokenizer("Hello, I'm a language model",return_tensors="pt")# Generate text with the modeloutputs=model.generate(**inputs,max_new_tokens=64)
fromoptimum.rblnimportRBLNAutoModelForCausalLMfromtransformersimportAutoTokenizer# Load and compile the model with inline parametersmodel=RBLNAutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf",export=True,# Set to True for compilationrbln_batch_size=1,rbln_max_seq_len=512,# Optional, inferred from model config if not specifiedrbln_num_devices=4,# For multi-device execution)# Load tokenizer and prepare inputstokenizer=AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")inputs=tokenizer("Hello, I'm a language model",return_tensors="pt")# Generate text with the modeloutputs=model.generate(**inputs,max_new_tokens=64)