inference from automodelforcausallm
Browse files- .gitignore +1 -0
- app.py +27 -1
- requirements.txt +17 -1
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.venv/
|
app.py
CHANGED
@@ -1,3 +1,29 @@
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
1 |
+
# import gradio as gr
|
2 |
+
|
3 |
+
# gr.load("models/Artigenz/Artigenz-Coder-DS-6.7B").launch()
|
4 |
import gradio as gr
|
5 |
+
import transformers
|
6 |
+
|
7 |
+
# Load the model and tokenizer
|
8 |
+
model_name = "Artigenz/Artigenz-Coder-DS-6.7B"
|
9 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
|
10 |
+
model = transformers.AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
11 |
+
|
12 |
+
# Function to generate responses from the model
|
13 |
+
def generate_response(input_text):
|
14 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
15 |
+
outputs = model.generate(**inputs, max_new_tokens=512)
|
16 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
17 |
+
return response
|
18 |
+
|
19 |
+
# Define the Gradio interface
|
20 |
+
iface = gr.Interface(
|
21 |
+
fn=generate_response,
|
22 |
+
inputs="text",
|
23 |
+
outputs="text",
|
24 |
+
title="Artigenz Coder - 6.7B Model",
|
25 |
+
description="A code-generation model from Artigenz. Enter a prompt to get code suggestions or completions."
|
26 |
+
)
|
27 |
|
28 |
+
# Launch the interface
|
29 |
+
iface.launch()
|
requirements.txt
CHANGED
@@ -1 +1,17 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
certifi==2024.8.30
|
2 |
+
charset-normalizer==3.4.0
|
3 |
+
filelock==3.16.1
|
4 |
+
fsspec==2024.10.0
|
5 |
+
huggingface-hub==0.25.2
|
6 |
+
idna==3.10
|
7 |
+
numpy==2.1.3
|
8 |
+
packaging==24.1
|
9 |
+
PyYAML==6.0.2
|
10 |
+
regex==2024.11.6
|
11 |
+
requests==2.32.3
|
12 |
+
safetensors==0.4.5
|
13 |
+
tokenizers==0.20.3
|
14 |
+
tqdm==4.67.0
|
15 |
+
transformers==4.46.2
|
16 |
+
typing_extensions==4.12.2
|
17 |
+
urllib3==2.2.3
|