Comments (4)
@garyyang85 I see
currently, there is VLLM integration underway: vllm-project/vllm#4636
from granite-code-models.
HI @garyyang85 , having trouble understanding the request.
Can you clarify?
There is an example in the README.md
you will need to install transformers from source for this though.
cross-pasting here as well:
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" # or "cpu"
model_path = "ibm-granite/granite-3b-code-base" # pick anyone from above list
tokenizer = AutoTokenizer.from_pretrained(model_path)
# drop device_map if running on CPU
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
model.eval()
# change input text as desired
input_text = "def generate():"
# tokenize the text
input_tokens = tokenizer(input_text, return_tensors="pt")
# transfer tokenized inputs to the device
for i in input_tokens:
input_tokens[i] = input_tokens[i].to(device)
# generate output tokens
output = model.generate(**input_tokens)
# decode output tokens into text
output = tokenizer.batch_decode(output)
# loop over the batch to print, in this example the batch size is 1
for i in output:
print(i)
from granite-code-models.
Hi @mayank31398 Thanks for your response.
Popular models may included in fastchat. I mean something like the api server in fastchat. It will load model only once and then accept standard openai request, return the stream answer. Like this: https://github.com/baichuan-inc/Baichuan2/blob/main/OpenAI_api.py
For test purpose, maybe Flask is enough. Of course I can follow the sample code to build one myself. :)
from granite-code-models.
@garyyang85 vllm-project/vllm#4636 is merged now.
closing this.
from granite-code-models.
Related Issues (10)
- Support infilling? HOT 4
- GQA? HOT 2
- Is softmax scaling optional? HOT 2
- Provide .GGUF files? HOT 8
- [Question] When were the knowledge thresholds set? HOT 1
- Question about PSM vs SPM HOT 2
- Provide models for group of computer languages. HOT 1
- finetuning with larger context HOT 5
- Feature Request: HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from granite-code-models.