Instructions to use mrm8488/falcoder-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mrm8488/falcoder-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mrm8488/falcoder-7b", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mrm8488/falcoder-7b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use mrm8488/falcoder-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mrm8488/falcoder-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrm8488/falcoder-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mrm8488/falcoder-7b
- SGLang
How to use mrm8488/falcoder-7b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mrm8488/falcoder-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrm8488/falcoder-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mrm8488/falcoder-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrm8488/falcoder-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mrm8488/falcoder-7b with Docker Model Runner:
docker model run hf.co/mrm8488/falcoder-7b
Issue with Falcoder LLM while trying to use it on AWS EC2 Inferentia 2.8xlarge Instance
Hi all,
We are facing issues while using this model on the aforementioned machine. We were able to run the same experiment on G5 instance successfully but we are observing that the same code is not working on Inf2 machine instance. We are aware that it has Accelerator instead of NVIDIA GPU. Hence we tried the neuron-core's capability and added required helper code for using the capability of neuron-cores of the instance by using the torch-neuronx library. The code changes and respective error screenshots are provided below for your reference:
Code without any torch-neuronx usage - Generation code snippet:
generation_output = model.generate(
input_ids = input_ids,
attention_mask = attention_mask,
generation_config = generation_config,
return_dict_in_generate = True,
output_scores = False,
max_new_tokens = max_new_tokens,
early_stopping = True
)
#print("generation_output")
#print(generation_output)
s = generation_output.sequences[0]
output = tokenizer.decode(s)
without any changes.png
Code using torch-neuronx - helper function code snippet:
def generate_sample_inputs(tokenizer, sequence_length):
dummy_input = "dummy"
embeddings = tokenizer(dummy_input, max_length=sequence_length, padding="max_length",return_tensors="pt")
return tuple(embeddings.values())
def compile_model_inf2(model, tokenizer, sequence_length, num_neuron_cores):
use only one neuron core
os.environ["NEURON_RT_NUM_CORES"] = str(num_neuron_cores)
import torch_neuronx
payload = generate_sample_inputs(tokenizer, sequence_length)
return torch_neuronx.trace(model, payload)
model = compile_model_inf2(model, tokenizer, sequence_length=512, num_neuron_cores=1)
with torch-neuron related code1.png
with torch-neuron related code2.png
Can this github issue address our specific problems mentioned above?
https://github.com/oobabooga/text-generation-webui/issues/2260
My queries are basically:
1.Is it even feasible to do inference on this machine or should we go for G4dn.8xlarge as we are facing so many issues in Inf2?
2. Can we try Llama 2 on Inferentia 2 8xlarge machine or this is not supported? If not, which machine instance we should try considering cost-effectiveness?
Hi all,
We are facing issues while using this model on the aforementioned machine. We were able to run the same experiment on G5 instance successfully but we are observing that the same code is not working on Inf2 machine instance. We are aware that it has Accelerator instead of NVIDIA GPU. Hence we tried the neuron-core's capability and added required helper code for using the capability of neuron-cores of the instance by using the torch-neuronx library. The code changes and respective error screenshots are provided below for your reference:
Code without any torch-neuronx usage - Generation code snippet:
generation_output = model.generate(
input_ids = input_ids,
attention_mask = attention_mask,
generation_config = generation_config,
return_dict_in_generate = True,
output_scores = False,
max_new_tokens = max_new_tokens,
early_stopping = True
)
#print("generation_output")
#print(generation_output)
s = generation_output.sequences[0]
output = tokenizer.decode(s)
Code using torch-neuronx - helper function code snippet:
def generate_sample_inputs(tokenizer, sequence_length):
dummy_input = "dummy"
embeddings = tokenizer(dummy_input, max_length=sequence_length, padding="max_length",return_tensors="pt")
return tuple(embeddings.values())
def compile_model_inf2(model, tokenizer, sequence_length, num_neuron_cores):
# use only one neuron core
os.environ["NEURON_RT_NUM_CORES"] = str(num_neuron_cores)
import torch_neuronx
payload = generate_sample_inputs(tokenizer, sequence_length)
return torch_neuronx.trace(model, payload)
model = compile_model_inf2(model, tokenizer, sequence_length=512, num_neuron_cores=1)
Can this github issue address our specific problems mentioned above?
https://github.com/oobabooga/text-generation-webui/issues/2260
My queries are basically:
- Is it even feasible to do inference on this machine or should we go for G4dn.8xlarge as we are facing so many issues in Inf2?
- Can we try Llama 2 on Inferentia 2 8xlarge machine or this is not supported? If not, which machine instance we should try considering cost-effectiveness?


