Commit
·
027bddb
1
Parent(s):
f8dc831
Updates
Browse files- .gitignore +1 -0
- finetune.py +26 -0
- luke-gromen/qa.txt +25 -1
- process.py +10 -5
- requirements.txt +14 -0
- upload.py +24 -0
.gitignore
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
*.jsonl
|
| 2 |
output/
|
|
|
|
|
|
| 1 |
*.jsonl
|
| 2 |
output/
|
| 3 |
+
.direnv
|
finetune.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Module to finetune a model in AnyScale."""
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
import openai
|
| 7 |
+
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
|
| 10 |
+
parser = argparse.ArgumentParser()
|
| 11 |
+
parser.add_argument("file_id", help="Specify the AnyScale file ID")
|
| 12 |
+
args = parser.parse_args()
|
| 13 |
+
|
| 14 |
+
api_key = os.environ.get('ANYSCALE_API_KEY')
|
| 15 |
+
|
| 16 |
+
client = openai.OpenAI(
|
| 17 |
+
base_url="https://api.endpoints.anyscale.com/v1",
|
| 18 |
+
api_key=api_key
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
job = client.fine_tuning.jobs.create(
|
| 22 |
+
model="meta-llama/Llama-2-7b-chat-hf",
|
| 23 |
+
training_file=args.file_id,
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
print(job)
|
luke-gromen/qa.txt
CHANGED
|
@@ -13,4 +13,28 @@ A: I don't save in the Swiss francs just because here in the US. I'd rather be g
|
|
| 13 |
Q: You've repeatedly stated your overweight gold and gold miners. Are all of your gold in physical custody? What about Gold ETFs? Any potential problems?
|
| 14 |
A: I own gold in physical format, gold bullion. That is my primary exposure. It is custody at a non bank custodian in the region. In terms of there are vaulting services in various big cities where you can store that are not affiliated with a bank. If you look those up, you can find out about those. That's where I have mine stored, at a vault there. That is where my primary exposure is. Problems with specific ETFs. For me, I just think it's important to understand that if you're going to own gold, you should own gold. GLD is a great trading vehicle. There's nothing wrong with it. If I owned gold or I wanted to own gold for the reasons that I want to own gold and that I encourage people to own gold, I don't think GLD is an optimal vehicle. I would much rather own the physical bullion. Let's see.
|
| 15 |
Q: If you had the opportunity to hold mutual funds of oil or gold equities hedged in Swiss francs, would you choose to do so? If not, why?
|
| 16 |
-
A: For me, it's a personal choice, understanding that what we're seeing should squeeze the dollar higher, number one, even as everything else kind of comes unhinged. But then, number two, I live in the US, spend in the US. So for me it's dollars. If I lived in Switzerland, I probably would store a good portion or in Europe for that matter, I probably would store a good portion of my currency holdings in Swiss franc. So that's how I've thought about it historically.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
Q: You've repeatedly stated your overweight gold and gold miners. Are all of your gold in physical custody? What about Gold ETFs? Any potential problems?
|
| 14 |
A: I own gold in physical format, gold bullion. That is my primary exposure. It is custody at a non bank custodian in the region. In terms of there are vaulting services in various big cities where you can store that are not affiliated with a bank. If you look those up, you can find out about those. That's where I have mine stored, at a vault there. That is where my primary exposure is. Problems with specific ETFs. For me, I just think it's important to understand that if you're going to own gold, you should own gold. GLD is a great trading vehicle. There's nothing wrong with it. If I owned gold or I wanted to own gold for the reasons that I want to own gold and that I encourage people to own gold, I don't think GLD is an optimal vehicle. I would much rather own the physical bullion. Let's see.
|
| 15 |
Q: If you had the opportunity to hold mutual funds of oil or gold equities hedged in Swiss francs, would you choose to do so? If not, why?
|
| 16 |
+
A: For me, it's a personal choice, understanding that what we're seeing should squeeze the dollar higher, number one, even as everything else kind of comes unhinged. But then, number two, I live in the US, spend in the US. So for me it's dollars. If I lived in Switzerland, I probably would store a good portion or in Europe for that matter, I probably would store a good portion of my currency holdings in Swiss franc. So that's how I've thought about it historically.
|
| 17 |
+
Q: We just made you president. Congrats. You have a compliant Congress, Fed, and electorate. What three steps would you take in the next four years to revitalize the world's largest em emerging market fly over America?
|
| 18 |
+
A: I would implement industrial policy and the Defense Production Act to pay for trades education along with wage subsidies for young people. So basically what I mean by that is you get a free education and every welder comes out making $350,000 a year thanks to the US government, auto workers, machinists, et cetera, plumbers skilled trades get paid, and you do it for a very finite period of time, that's number one. And then after a certain number of years, the wage subsidies fade off and they're probably making that much on their own. Number two is aggressive industrial policy implementation for the rollout of something like the small modular reactors, fission reactors that we were talking about before, and a revitalization of the electrical grid as well as some domestic public transportation. And I do it via Executive Order and the Defense Production Act. So I just override everybody else and all their NIMBY backyard bullshit. I probably within that optimize our pipeline network for natural gas to make us less dependent, particularly on the East Coast, on global LNG markets. And then three, let's see here. Oh, I instruct the Fed YCC pay for the whole thing, cap bond yields, and we're going to inflate for a bit and I explain it to the American people and that's going to be it. And after five years that the GDP is back down to 50, 60% from 120. That's probably very high rates of inflation. And I've rebalanced the economy in terms of getting away from the massively oversized financialized side of it. And much have revitalized domestic infrastructure, have revitalized domestic skills, and trades have written down the debt on a real basis enough such that we can then re separate the Fed. From the treasury and let the Fed run an independent monetary policy that does not blow up the treasury market, which is happening as we speak, like I said it was going to because they didn't inflate enough of it away.
|
| 19 |
+
Q: Given your view on long duration sovereign debt and real terms, could you clarify your position on Tips with long dated real yields at around positive 2%?
|
| 20 |
+
A: If all you can own are Tips, if you can own gold, then I guess that that's fine. And there's probably certain retirement accounts or 401K choices where maybe that's the case, depending on your employer. I would rather own gold bullion as a long duration asset, along with commodities, et cetera. The reality is the US. Government cannot afford positive real rates for very long. So when does that sort of force something? I don't know. That's how I've thought about tips. I think it's fine. Particularly it does give you an income that gold doesn't. For me, I would think of it as almost like a complement of a slight coupon to gold, not as the core inflation hedge that I want to hold going forward.
|
| 21 |
+
Q: If the total amount of US debt is pushing the economy to the point where it's crowding out other investments, if the foreign buyers are beginning to be sellers, and if there are not enough replacement buyers, that leaves the Fed itself, either through QE or through open market purchases. Branding stabilizing the orderly function of the treasury market. What does that really mean? I know what it means technically. I know how it creates money and how that happens.
|
| 22 |
+
A: What I'm asking really is what it means. As the interest burden mounts on debt that exceeds over GDP, at what point does it become a house of cards and who pushes it over? Because if we are in need of funding, we satisfy that need by buying our own debt. What's really happening, what we're really talking about is deciding who gets hurt in the restructuring of the debt. What I'm talking about doing is you're basically taxing bondholders via inflation and financial repression to finance government programs. If the government programs are for ill advised wars or for low productivity social programs and entitlements, that's a bit problematic. If you use some of that money to invest into productivity enhancers like I just described upgrading the electrical grid, training young people to really be able to produce in the trades and have the US stimulus filter through to a middle class and have it feed on itself for years and decades like it did from the 50s through the 80s, then it's very productive. But that's ultimately what we're talking about here is this whole everything is all about deciding who takes the loss. The loss has already happened. The money's already been spent. It's been wildly unproductive. We spent $8 trillion in the Middle East. It's gone. And it was completely useless. We spent it in blood and treasure to secure the Middle East's oil for China. And we transferred a quorum, our industrial base to China to help pay for it. It was a galactically bad decision compounded by more galactically bad decisions. And then when it blew up the banking system, we backstop the banks, but not us homeowners. And so that money's gone, it's lost. So right now we're just debating. It's all a big debate about who takes the loss. Do the bondholders take the loss or do the bondholders get paid in real terms? The bondholders get paid in real terms. We have a great depression. If the bondholders take the loss, we have a sustained period of high inflation. The latter tends to be the more politically palatable outcome. Not that it's pleasant, but just more politically palatable.
|
| 23 |
+
Q: On or near September 17, there was a large and sudden spike in the two year treasury yield, perhaps best summarized by Nothing Special Finance, as this occurred during pre market trading on a day following Quad Witching and with japanese markets closed for a holiday. It appears there may have been a liquidity transient in one of the most important financial assets in the world. And the financial press is radio silent on the issue. Do you have a view as to what this may have been?
|
| 24 |
+
A: It's a good question. I saw it. I watched it. I saw it described and explained away as nothing or an accident or a fat finger or a data feed error. And I was inclined to believe that until I saw treasury markets that week be very sloppy all week. And so maybe it wasn't nothing. What was it? I don't know. But the takeaway I took from that is if it was nothing, treasury markets shouldn't have been as sloppy as they were last week. And yet they were very sloppy and they've continued to be sloppy this week. So as I like to say, let's watch. But after watching how treasury markets traded, I'm not willing to completely dismiss it as purely a fat finger. I think there may have been some signal there.
|
| 25 |
+
Q: **What percentage of interest stimmies are going to foreign countries? Isn't this a difference when compared to government handouts during COVID Yes, it is a difference.**
|
| 26 |
+
A: Around 25% of US treasuries outstanding are held by foreigners. It's also a political question. 5% interest on short term Treasuries. If China's 800 and whatever $50 billion in holdings were all in short term Treasuries, they're getting 5%. That's $40 to $45 billion we're handing to China. By way of comparison, that is enough to pay for about 15 to almost 20% of China's defense budget. Think about that. Isn't that nice? We're paying for our defense budget and 15% to 20% of theirs. Great job, Powell. Nice job. So, yeah, it is different. It's different in some less inflationary ways because it is going to foreigners and it's different in some politically challenging or tricky complicated ways, like I just described.
|
| 27 |
+
Q: Could you expand on your Bitcoin enthusiasm a bit more specifically? What do you like about it as an asset? Unlike gold, the physical properties are not there, and mass acceptance as a medium exchange store of value does not seem anywhere on the horizon. For me, Bitcoin is a function of market liquidity and will rise as liquidity expands again, which you believe is on the way, given the structural deficits the US government's running.
|
| 28 |
+
A: So from the end first, yeah, I think it's a great liquidity metric. It's very sensitive to that, as it's shown. And I do think that liquidity is going to have to come for reasons we've discussed. For me, the proof of work dynamic. The energy that has to be expended both to mine the Bitcoin and then to keep the network running and to validate the various transactions is the attraction. It requires you to spend a lot of energy to produce and maintain. And that's like the real world. Me doing my job, me living my life, me having my house, all requires me to spend a lot of energy, finite energy, to produce and to maintain. And so I would rather own a reserve asset that does that than a reserve asset like a treasury bond that can just be created out of thin air and printed dollars printed up by the Fed to buy when they don't like the price, which they've repeatedly done. That's my thought process on it. In terms of the adoption, I would encourage you to take a look around and just sort of start digging into that. The lightning network there is a still quiet, for the moment, not very highly visible, but rapidly growing ecosystem that is facilitating the usage in a lot of really creative and value added ways. And so, yes, there's not medium exchange or mass acceptance right now. I think that's going to change. I think we're going to wake up in five years or seven years and find that that has changed a whole lot
|
| 29 |
+
Q: What is the best way to hold cash?
|
| 30 |
+
A: Money market funds. Seems to have everyone in them. Makes me nervous. Feels like a lesser of two evils type of choice. No, I think money market funds are fine. They're holding government debt, you're going to get paid and they've got higher yield, generally speaking. So I've got a whole lot when I have overweight cash, a lot of it's money market. From Dr. Stallard or Dr. Stallard the no landing, soft landing or hard landing and when the US being in fiscal dominance means no landing on a nominal basis, hard landing on a real basis, that nuance I think is what is in my view going to happen.
|
| 31 |
+
Q: what extent will using or holding foreign currencies act as a successful buffer or hedge against a dollar sovereign debt crisis, central bank digital currency mandates and currency devaluation if possible. Can you speak about the Canadian dollar, aussie dollar and Singapore dollar in this regard?
|
| 32 |
+
A: In my opinion, given the structure of the system as it is today, I would rather own dollars, gold and a little bit of bitcoin dollars should get squeezed higher along with gold and bitcoin once the liquidity comes. Bitcoin, I think needs to be scaled appropriately for every investor individually depending on its volatility. But that is how I think about holding currencies to get through the most likely range of outcomes. Now, if I was Canadian or Australian or in Singapore, I would probably adjust that a, you know, for me as an American I don't see much used to doing that, but I also don't see any use to holding long term treasuries. I want to hold my duration in gold and bitcoin. So that's how I've thought about it.
|
| 33 |
+
Q: You often talk about the US being able to inflate the way out of the debt problem. My math suggests it's not really true, given so much of the budget is in real terms, and even as you inflate your way out, the debt spiral of rates takes hold. Don't see that much value of even devaluing the debt balances by 50%. You still end up in an untenable situation.
|
| 34 |
+
A: If you do one year of 40% inflation and you yield curve control at three, you're going to decrease the debt to GDP by 40 minus 337 percent. So that's where this has to go. There's a lot of gnashing of teeth and dragging of feet and hoping it's not true and praying for an energy miracle, energy productivity miracle. In the end, that's where this movie always goes. So that's, I think, how it's going to go again. And then you keep discussing the 1.8 trillion in US. Treasury issuance in second half of this year. We're already halfway through. Was curious to know what remains or what's on the horizon. And then in first half of 24, in the scenario where the US. Tries to inflate their way out of the problem, can you talk through what that means for foreigners who rely on dollar for commodity trade flows and own large US. Reserves? I don't know exactly what's left. There's still a lot to issue here before the end of the year, but I don't know the exact number. What does it mean for foreigners relying on the dollar? It means they've got to transact in other currencies because it's to inflate their commodity flows dramatically. So they need to reserve anything other than treasuries for their commodity purchases or their commodity surpluses. So I think it will accelerate the de dollarization of global commodity flows as the US. Has to inflate its way out of debt or out of debt to GDP. And for those who own large perfect example those who own large dollar reserves, they need to move them to gold. And you're seeing that I think that's exactly why that's happening. Ultimately. Let's see, if gold does get recapitalized, what does that do to purchasing power parity in real terms of country reserves? I e. Did Russia just get a whole lot richer on a relative basis? In short, yeah. Exactly what do you think are the possible domino paths that could unfold for the fiscal position and likely responses? To me, the most likely domino path is dollar up rates up, risk assets down, nonlinearly, and then the Fed has to come in and backstop the treasury market and probably other debt markets as well, with printed money yield curve control, et cetera. I think that's really the only path. The only question is how much pain does that entail?
|
| 35 |
+
Q: What if to fight all the inflation and issue and as part of a central bank digital currency rollout, us. Treasury decides to demonetize any $100 bill, would it not instantly bring in productivity that helps them?
|
| 36 |
+
A: I had to look up how many hundred dollars bills are outstanding. According to the Fed's website, there are 18.5 billion $100 notes outstanding. So if I'm carrying my zeros right, 18 and a half billion times ten is 185 times another ten is $1.85 trillion in $100 notes outstanding. That if you demonetized forced people to turn them in for tens and cetera to the extent a lot of them went away because a lot of them are probably foreign, sitting in places where we have used them to how can I be diplomatic? Pay people. Is there a productivity gain? I guess in theory, but I don't know how to think about that. From a velocity or conversion ratio or productivity pickup. But that's at least hopefully gives you some context or background for the numbers we're talking about.
|
| 37 |
+
Q: As fiscal dominance plays out in the US. And the Fed restarts QE and yield curve control, what happens next? Would financial repression take over and the high inflation versus yields resolve the debt issue over time? Or would a default and restructuring the debt be the most likely outcome?
|
| 38 |
+
A: You can't default on the debt. It's the collateral. Underpinning everything else, they default on the debt as a restructuring. It's Armageddon. You just can't do it. So they're going to have to make it money, good collateral. They basically have to fully reserve the debt. What that means is they have to print the money. And so I do think you'll see financial repression. I mean, yield curve control is de facto financial repression. So the challenges is it's like the Hotel California for the Fed. Once you check in, you can never leave. So it's not like bondholders that aren't holding Treasuries aren't going to sell Treasuries agencies, et cetera. They're going to have to buy a lot of it once they get there. So it's going to be tough because defaulting restructuring is simply not an option.
|
| 39 |
+
Q: I agree that gold's presence in a portfolio is a must, but one thing the US and its allies can't afford at this point is for investors to question the value of the dollar versus tangible assets. To what extent do you think the US will try to postpone, suppress and even block its citizens to act upon the inevitable realization through policy, political or other means?
|
| 40 |
+
A: I think the US has been doing this for 40 years already. When you see sell your gold at we buy gold stands, gold is useless. Empty out your drawers. Hey GLD, get rid of that physical gold bullion in your portfolio. It's heavy, it's inconvenient, it's hard to buy, and instead sell it and buy GLD, it's a low fee and it's easier, et cetera. The US public has already largely been dishoarded of its gold. There won't need to be a confiscation, it's already happened. Will they in some sort of revaluation? I don't think so. I think there's going to be easier places to grab money. I mean, you want to go door to door and try to find people if anyone has any gold left after the last 40 years of taking gold off people in America, or you can with a few keystrokes, confiscate 401 KS or force them to put 50% of it into treasury bonds at negative real rates. The latter is way easier. I think it's important to be cognizant of this as a risk for gold, but I think it's important to be cognizant of this as a risk for a lot more than gold, for everything. And like Willie Sutton said, when he was asked, Why do you rob banks? He apocryphally said, because that's where the money is. Well, if the government wants to rob Americans, they're not going to go looking for gold. They're going to go looking for stocks, they're going to look for bonds. So that is how I have thought about that. Ultimately, like I said before, it's becoming apparent China has gained control of gold. You can see it in the change in price versus East West flows we've highlighted. You can see it in real rates versus gold. You can see it in downside volatility of gold versus Treasuries. Something very important has changed on that front. So it may no longer be simply a US discussion, as it has been for 40 decision as it has been for 40 or 50 years.
|
process.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
import logging
|
| 3 |
import os
|
| 4 |
import json
|
| 5 |
-
import os
|
| 6 |
-
import os
|
| 7 |
-
import json
|
| 8 |
|
| 9 |
|
| 10 |
OUTPUT_DIR = os.path.join('.', 'output')
|
|
@@ -51,7 +49,7 @@ def generate_jsonlines(directory, output_filename):
|
|
| 51 |
{'role': 'assistant', 'content': line[2:].strip()}
|
| 52 |
])
|
| 53 |
|
| 54 |
-
with open(output_filename, 'w', encoding='
|
| 55 |
for message in messages:
|
| 56 |
jsonl_file.write(json.dumps({'messages': message}) + '\n')
|
| 57 |
|
|
@@ -80,6 +78,13 @@ def verify_file(file_path):
|
|
| 80 |
return True
|
| 81 |
|
| 82 |
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
| 85 |
|
|
|
|
| 1 |
+
"""Module to generate a JSON Lines file from intro.txt and qa.txt files in a given directory."""
|
| 2 |
+
|
| 3 |
import logging
|
| 4 |
import os
|
| 5 |
import json
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
OUTPUT_DIR = os.path.join('.', 'output')
|
|
|
|
| 49 |
{'role': 'assistant', 'content': line[2:].strip()}
|
| 50 |
])
|
| 51 |
|
| 52 |
+
with open(output_filename, 'w', encoding='utf-8') as jsonl_file:
|
| 53 |
for message in messages:
|
| 54 |
jsonl_file.write(json.dumps({'messages': message}) + '\n')
|
| 55 |
|
|
|
|
| 78 |
return True
|
| 79 |
|
| 80 |
def main():
|
| 81 |
+
"""
|
| 82 |
+
Main function to generate JSON Lines files from intro.txt and qa.txt files in the current directory.
|
| 83 |
+
|
| 84 |
+
It creates an output directory if it doesn't exist and processes each subdirectory in the current directory.
|
| 85 |
+
For each subdirectory, it generates a JSON Lines file with the same name as the subdirectory.
|
| 86 |
+
|
| 87 |
+
"""
|
| 88 |
|
| 89 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
| 90 |
|
requirements.txt
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
annotated-types==0.6.0
|
| 2 |
+
anyio==4.2.0
|
| 3 |
+
certifi==2023.11.17
|
| 4 |
+
distro==1.9.0
|
| 5 |
+
h11==0.14.0
|
| 6 |
+
httpcore==1.0.2
|
| 7 |
+
httpx==0.26.0
|
| 8 |
+
idna==3.6
|
| 9 |
+
openai==1.6.1
|
| 10 |
+
pydantic==2.5.3
|
| 11 |
+
pydantic_core==2.14.6
|
| 12 |
+
sniffio==1.3.0
|
| 13 |
+
tqdm==4.66.1
|
| 14 |
+
typing_extensions==4.9.0
|
upload.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Module to upload a file into Anyscale for fine-tuning."""
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
import openai
|
| 7 |
+
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
|
| 10 |
+
parser = argparse.ArgumentParser()
|
| 11 |
+
parser.add_argument("filename", help="Specify the filename to upload")
|
| 12 |
+
args = parser.parse_args()
|
| 13 |
+
|
| 14 |
+
api_key = os.environ.get('ANYSCALE_API_KEY')
|
| 15 |
+
|
| 16 |
+
client = openai.OpenAI(
|
| 17 |
+
base_url="https://api.endpoints.anyscale.com/v1",
|
| 18 |
+
api_key=api_key
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Upload file to Anyscale
|
| 22 |
+
with open(args.filename, "rb") as f:
|
| 23 |
+
file = client.files.create(file=f, purpose="fine-tune")
|
| 24 |
+
print(file)
|