Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IndiQuo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Schlüsselstellen
IndiQuo
Commits
c1391002
Commit
c1391002
authored
1 year ago
by
Frederik Arnold
Browse files
Options
Downloads
Patches
Plain Diff
Delete LeoLM
parent
b4340301
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indiquo/LeoLM.py
+0
-70
0 additions, 70 deletions
indiquo/LeoLM.py
with
0 additions
and
70 deletions
indiquo/LeoLM.py
deleted
100644 → 0
+
0
−
70
View file @
b4340301
from
transformers
import
AutoModelForCausalLM
,
AutoTokenizer
,
pipeline
import
torch
def
main
():
model_name_or_path
=
"
TheBloke/leo-hessianai-70B-chat-AWQ
"
tokenizer
=
AutoTokenizer
.
from_pretrained
(
model_name_or_path
)
model
=
AutoModelForCausalLM
.
from_pretrained
(
model_name_or_path
,
low_cpu_mem_usage
=
True
,
device_map
=
"
cuda:0
"
)
system_prompt
=
"
Du bist ein System zur Zusammenfassung von Dramentexten. Du bekommst einen Text und erzeugst eine kurze Zusammenfassungen von 2-3 Sätzen.
"
prompt_format
=
"
<|im_start|>system
\n
{system_prompt}<|im_end|>
\n
<|im_start|>user
\n
{prompt}<|im_end|>
\n
<|im_start|>assistant
\n
"
prompt
=
'''
IPHIGENIE.
Heraus in eure Schatten, rege Wipfel
Des alten, heil
'
gen, dichtbelaubten Haines,
Wie in der Göttin stilles Heiligtum
Tret
'
ich noch jetzt mit schauderndem Gefühl,
Als wenn ich sie zum erstenmal beträte,
Und es gewöhnt sich nicht mein Geist hierher.
So manches Jahr bewahrt mich hier verborgen
Ein hoher Wille, dem ich mich ergebe;
Doch immer bin ich, wie im ersten, fremd.
Denn ach! mich trennt das Meer von den Geliebten,
Und an dem Ufer steh
'
ich lange Tage,
Das Land der Griechen mit der Seele suchend;
Und gegen meine Seufzer bringt die Welle
Nur dumpfe Töne brausend mir herüber.
Weh dem, der fern von Eltern und Geschwistern
Ein einsam Leben führt! Ihm zehrt der Gram
Das nächste Glück vor seinen Lippen weg,
Ihm schwärmen abwärts immer die Gedanken
Nach seines Vaters Hallen, wo die Sonne
Zuerst den Himmel vor ihm aufschloß, wo
Sich Mitgeborne spielend fest und fester
Mit sanften Banden aneinander knüpften.
Ich rechte mit den Göttern nicht, allein
Der Frauen Zustand ist beklagenswert.
Zusammenfassung:
'''
generation_params
=
{
"
do_sample
"
:
True
,
"
temperature
"
:
0.9
,
"
top_p
"
:
0.95
,
"
top_k
"
:
40
,
"
max_new_tokens
"
:
512
,
"
repetition_penalty
"
:
1.1
}
pipe
=
pipeline
(
"
text-generation
"
,
model
=
model
,
tokenizer
=
tokenizer
,
**
generation_params
)
pipe_output
=
pipe
(
prompt_format
.
format
(
system_prompt
=
system_prompt
,
prompt
=
prompt
))[
0
][
'
generated_text
'
]
print
(
"
pipeline output:
"
,
pipe_output
)
# generator = pipeline(model="LeoLM/leo-hessianai-70b-chat", device="cuda", torch_dtype=torch.float16)
# print(generator(prompt_format.format(system_prompt=system_prompt, prompt=prompt), do_sample=True, top_p=0.95, max_length=8192))
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment